package xyz.xmh.pattern.structural.filterpattern;

import java.util.ArrayList;
import java.util.List;

/**
 * CriteriaMale
 * 男性标准
 *
 * @author xuMingHai
 * @since 2021/4/30 星期五 14:08
 */
public class CriteriaMale implements Criteria {

    @Override
    public List<Person> meetCriteria(List<Person> personList) {
        List<Person> malePersonList = new ArrayList<>();

        // 遍历集合过去性别为男性
        for (Person person : personList) {

            if ("MALE".equalsIgnoreCase(person.getGender())) {
                malePersonList.add(person);
            }
        }

        return malePersonList;
    }
}
